#include <GL/glew.h>
#include <GL/glut.h>
#include <cmath>
#include "utility.h"
#include "cursor.h"

float mousePosition[2] = {0.0f,0.0f};

/*
void GetMouseInfo()
{
static Point lastMouse (0.0f, 0.0f, 0.0f);
//Get current mouse position
GetCursorPos(&lastMouse);
//Set cursor position to some point so that the
//movement can be calculated later on 
SetCursorPos(320,240);

//Calculate movement of the mouse with the above coords
float moveX = float((320 - lastMouse.x))/100.0f;
float moveY = float((240 - lastMouse.y))/100.0f;

//Update mouse position
mousePosition[0] -= moveX;
mousePosition[1] += moveY;
}
*/

void DrawMouseCursor()
{
	//Will be transparent
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	glDisable(GL_DEPTH_TEST);
	/*
	//Draw the cursor at the current mouse pos
	glBegin(GL_TRIANGLES);
	glColor4f(0.75,0.75,0.75,0.75);
	glVertex3f(mousePosition[0],mousePosition[1],ZOOM);
	glVertex3f(mousePosition[0],mousePosition[1]-0.5f,ZOOM);
	glVertex3f(mousePosition[0]+0.5f,mousePosition[1],ZOOM);
	glEnd();
	*/

	glBegin(GL_TRIANGLE_FAN) ;
	glColor4f(0.75,0.75,0.75,0.75);
	for (float angle = 0.0 ; angle <= 3.1415926*2 ; angle += 0.1)
	{
		glVertex3f(mousePosition[0] + sin(angle) * BRUSH_SIZE, mousePosition[1] + cos(angle) * BRUSH_SIZE, ZOOM);
	}
	glEnd();

	//Alles wird wie vorher
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}